<?php


/**
 * 客户端code 解析成数组
 */
if (!function_exists('decodeCode')) {
    function decodeCode($code){ 
        $res = explode(',', unlock_url($code));
        return $res; 
    } 
}

// 生成参数code
if (!function_exists('createCode')) {
    function createCode($agent_id,$openid){
        $code = lock_url(random(1).','.$agent_id.','.$openid.','.time());
        return $code;
    }
}

/**
 * 客户端 转移跳转其他网址
 */
if (!function_exists('errorGo')) {
    // function errorGo($tag,$url = '/index.html?'){ 
    //     return redirect($url.$tag.'=1');
    // } 
    function errorGo($tag,$url = 'https://xw.qq.com?'){ 
        return redirect($url.$tag.'=1');
    } 
}

//生成订单号
function createOrderNo()
{
    // 订单流水号前缀
    $prefix = date('YmdHis');
    $no = $prefix.str_pad(random_int(0, 99999999), 8, '0', STR_PAD_LEFT);
    return $no;
}